<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE);
define('PATH', dirname(__FILE__).'/');
define('LIMIT_PERPAGE', 5);
session_start();
$_SESSION[SESSION_L] = 1;
//load config file
require_once PATH.'config.php';

require_once PATH.'lib/fw/core.php';
require_once PATH.'lib/fw/index.php';
require_once PATH.'modules/shares.php';
require_once PATH.'modules/settings.php';

$translations = array(
	'about_us' => 'about us',
	'category' => 'category', 
	'event' => 'event', 
	'faq' => 'FAQ', 
	'contact_us' => 'contact us', 
	'settings' => 'settings'
);

$menu = menu_show();

$body = '';
$logo = '<a id="header-logo" href="index.php"><img src="im/other/logo.png"></a>';

//define class
$header_class = 'class="big"';
$header_menu = '';
$header_menu_class = '_home';
if ($_REQUEST['mod']) {
	$header_class = 'class="thin"';
	$header_menu_class = '';
	$n = 1;
	$header_menu = '<h2 id="section-menu-title" style="top: 0px; transition: all 2s cubic-bezier(0.25, 0.1, 0.25, 1) '.$n.'s ; -moz-transition: all 2s cubic-bezier(0.25, 0.1, 0.25, 1) '.$n.'s; -webkit-transition: all 2s cubic-bezier(0.25, 0.1, 0.25, 1) '.$n.'s; -o-transition: all 2s cubic-bezier(0.25, 0.1, 0.25, 1) '.$n.'s;">'.msg1($_REQUEST['mod']).'</h2>';
}

//define function
if ($_REQUEST['mod']) {
	$title .= msg($_REQUEST['mod']);
	$file_load = PATH.'modules/'.$_REQUEST['mod'].'.php';
	if (file_exists($file_load)) {
		require_once $file_load;
	}

	$fn .= $_REQUEST['mod'];
} else {
	$fn = 'landing';
}

if ($_REQUEST['view']) {
	$title .= '-'.msg($_REQUEST['view']);
	$fn .= '_' . $_REQUEST['view'];
} else {
	if ($_REQUEST['mod'] == 'settings') {
		$fn .= '_landing';
	}
}

//content
$content = $fn.'...';
if (function_exists($fn)) {
	$content = $fn();
}

if ($_REQUEST['ajax'] == 1) {
	echo $content;
	exit;
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<title><?php echo $title;?></title>
<script type="text/javascript" src="lib/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="lib/js/jquery-ui-1.8.23.custom.min.js"></script>
<script type="text/javascript" src="lib/js/jquery.form.js"></script>
<script type="text/javascript" src="lib/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="lib/fw/fields.js"></script>
<script type="text/javascript" src="modules/shares.js"></script>
<link href="css/screen.min.css" rel="stylesheet" type="text/css" media="all">
<link href="css/style.css" rel="stylesheet" type="text/css" media="all">
<?php 
if ($_REQUEST['mod'] == 'settings' && ($_REQUEST['link'] == 'edit' || $_REQUEST['link'] == 'add')) {
?>
	<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		skin : "o2k7",
		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
		</script>
<?php
}
?>
</head>
<body>
<div id="header"<?php echo $header_class;?>>
	<?php echo $logo;?> 
	<div id="header-menu<?php echo $header_menu_class;?>"> 
		<?php echo $menu;?> 
	</div>
	<?php 
	echo $header_menu;?>
</div>
<div id="body">
	<?php echo $content;?>
</div>
<a id="page-back" href="index.php<?php echo $more_link;?>" style="left: -100px; transition: all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 3s ; -moz-transition: all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 3s; -webkit-transition: all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 3s; -o-transition: all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 3s; background-color: #AF1E3D;"></a>
<script type="text/javascript">
	$(document).ready(function(){
		$("#credits").css("opacity", 1);
		$("#page-back").css("left", "28px").mouseover(function(){
			$(this).css("transition", "all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 2s").css("background-color", "#E23D64");
		}).mouseout(function(){
			$(this).css("transition", "all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 2s").css("background-color", "#AF1E3D");
		});

		$(".big #header-menu_home")
		.css("transition", "all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 2s")
		.css("-moz-transition", "all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 2s")
		.css("-webkit-transition", "all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 2s")
		.css("-o-transition", "all 1s cubic-bezier(0.25, 0.1, 0.25, 1) 2s")
		.css("opacity", 1);

	});
</script>
</body>
</html>